package com.evany.cloud.evanySolr.common;

import com.evany.cloud.evanyCommon.util.IdUtil;
import com.evany.cloud.evanyCommon.util.IdWorker;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;

/**
 * 公共属性init
 */
@Configuration
public class CommonConfig {
	@Value("${spring.idworker.workerId}")
	private Long workerId;
	@Value("${spring.idworker.dataCenterId}")
	private Long dataCenterId;

	@PostConstruct
	public void getIdWorker() {
		IdWorker idWorker = new IdWorker(workerId, dataCenterId);
		IdUtil.idWorker = idWorker;     //同步初始化ID生成器
	}


}
